#include "Math4D.h"


Math4D::Math4D(){
}


Math4D::~Math4D(){
}

vec4 Math4D::cross4(vec4 U, vec4 V, vec4 W){
	double A, B, C, D, E, F;
	A = (V[0] * W[1]) - (V[1] * W[0]);
	B = (V[0] * W[2]) - (V[2] * W[0]);
	C = (V[0] * W[3]) - (V[3] * W[0]);
	D = (V[1] * W[2]) - (V[2] * W[1]);
	E = (V[1] * W[3]) - (V[3] * W[1]);
	F = (V[2] * W[3]) - (V[3] * W[2]);

	vec4 result;
	result[0] =	  (U[1] * F) - (U[2] * E) + (U[3] * D);
	result[1] = - (U[0] * F) + (U[2] * C) - (U[3] * B);
	result[2] =   (U[0] * E) - (U[1] * C) + (U[3] * A);
	result[3] = - (U[0] * D) + (U[1] * B) - (U[2] * A);

	return result;
}
